package model.onetoone;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 * The persistent class for the wife database table.
 * 
 */
@Entity
@Table(name = "wife")
@NamedQuery(name = "Wife.getLastWife", query = "select max(w.wId) from Wife w")
public class Wife implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "w_id", unique = true, nullable = false)
	private int wId;

	@Column(name = "w_name", nullable = false, length = 45)
	private String wName;

	// bi-directional one-to-one association to Husband
	@OneToOne(mappedBy = "wife", cascade = { CascadeType.ALL })
	private Husband husband;

	public Wife() {
	}

	public int getWId() {
		return this.wId;
	}

	public void setWId(int wId) {
		this.wId = wId;
	}

	public String getWName() {
		return this.wName;
	}

	public void setWName(String wName) {
		this.wName = wName;
	}

	public Husband getHusband() {
		return this.husband;
	}

	public void setHusband(Husband husband) {
		this.husband = husband;
	}

}